import java.util.concurrent.CountDownLatch;

public class SportDemo {

    public static void main(String[] args) {
        CountDownLatch countDownLatch=new CountDownLatch(5);
        for (int i = 0; i <5 ; i++) {
            int finalI = i;
            new Thread(() -> {
                System.out.println((finalI +1)+"号运动员到达终点");
                countDownLatch.countDown();
            }).start();
        }

        try {
            countDownLatch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("比赛结束");
    }
}
